<?php

require_once dirname(__FILE__) . '/../lib/rubrosGeneratorConfiguration.class.php';
require_once dirname(__FILE__) . '/../lib/rubrosGeneratorHelper.class.php';

/**
 * rubros actions.
 *
 * @package    tercermilenio
 * @subpackage rubros
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class rubrosActions extends autoRubrosActions {

    /**
     * Redefine para comprobar si el nombre del rubro ya existe.
     * @param sfWebRequest $request
     * @param sfForm $form
     */
    /* protected function processForm(sfWebRequest $request, sfForm $form) {
        $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
       if ($form->isValid()) {
            $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';

            $rubro = new Rubros();
            if ($form->getObject()->isNew()) {
                $existe = $rubro->rubroExiste($form->getValue('rub_nombre'));
            } else {
                $existe = $rubro->rubroExiste($form->getValue('rub_nombre'), $form->getValue('rub_id'));
            }

            if (!$existe) {
                $rubros = $form->save();
            } else {
                $this->getUser()->setFlash('error', 'El nombre del rubro ya existe. Por favor, ingrese uno distinto.');
                $referer = $request->getReferer();
                $this->redirect($referer);
            }

            $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $rubros)));

            if ($request->hasParameter('_save_and_add')) {
                $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');

                $this->redirect('@rubros_new');
            } else {
                $this->getUser()->setFlash('notice', $notice);

                $this->redirect(array('sf_route' => 'rubros_edit', 'sf_subject' => $rubros));
            }
        } else {
            $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
        }
    
    }     * 
         */

}
